package com.gitee.wsl.doc.prosemirror.model.fragment.ext

import com.gitee.wsl.doc.prosemirror.model.fragment.Fragment

fun Fragment.dropFromFragment( depth: Int, count: Int): Fragment {
    val fragment = this
    if (depth == 0) return fragment.cutByIndex(count, fragment.childCount)
    return fragment.replaceChild(
        0,
        fragment.firstChild!!.copy(fragment.firstChild!!.content.dropFromFragment( depth - 1, count))
    )
}
